import React, {Component} from "react";
import {ScrollView, StyleSheet, Text} from "react-native";

export default class ScrollPage extends Component {

    _renderItem() {
        var temp = [];
        for (var i = 0; i < 300; i++) {
            temp.push(<Text
                style={styles.scrollView}
                key={i}>
                这是 {i}
            </Text>);
        }
        return temp;
    }

    render() {
        return (<ScrollView
            contentContainerStyle={styles.contentContainer}
            onScroll={() => {
                console.log('onScroll!');
            }}
            scrollEventThrottle={200}
        >
            {this._renderItem()}
        </ScrollView>);
    }
}
var styles = StyleSheet.create({
    contentContainer: {
        paddingVertical: 20
    },
    scrollView: {
        backgroundColor: '#6A85B1',
        height: 100
    }
});
